package com.houhanzhi.manager;

import com.houhanzhi.enums.ShortLinkStateEnum;
import com.houhanzhi.model.GroupCodeMappingDO;

import java.util.Map;

public interface GroupCodeMappingManager {

    /**
     * 查询详情
     * @param groupId 分组id
     * @param mappingId 详情id
     * @param accountNo 账号id
     * @return
     */
    GroupCodeMappingDO findByGroupIdAndMappingId(Long groupId, Long mappingId, Long accountNo);

    /**
     * 新增
     * @param groupCodeMappingDO
     * @return
     */
    int add(GroupCodeMappingDO groupCodeMappingDO);

    /**
     * 根据短链码删除
     * @param groupCodeMappingDO
     * @return
     */
    int del(GroupCodeMappingDO groupCodeMappingDO);

    /**
     * 分页查询
     * @param pageNum
     * @param pageSize
     * @param groupId
     * @param accountNo
     * @return
     */
    Map<String, Object> pageShortLinkByGroupId(int pageNum, int pageSize, Long groupId, Long accountNo);

    /**
     * 更新短链码状态
     * @param groupId
     * @param accountNo
     * @param shortLinkCode
     * @param shortLinkStateEnum
     * @return
     */
    int updateGroupCodeMappingState(Long groupId, Long accountNo, String shortLinkCode, ShortLinkStateEnum shortLinkStateEnum);

    /**
     * 查找短链码是否存在
     * @param shortLinkCode
     * @param groupId
     * @param accountNo
     * @return
     */
    GroupCodeMappingDO findByCodeAndGroupId(String shortLinkCode, Long groupId, Long accountNo);

    /**
     * 更新短链
     * @param groupCodeMappingDO
     * @return
     */
    int update(GroupCodeMappingDO groupCodeMappingDO);
}
